package com.aaa.a1107.demo01;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;

/**
 * @author 荆豪峰
 * @version 1.0
 */
public class Test03 {
    public static void main(String[] args) {
        //获取指定的时间
        LocalTime of1 = LocalTime.of(11, 12);
        //创建指定的日期
        LocalDate of = LocalDate.of(2022, 11, 7);

        //获取当前时间
        LocalTime now1 = LocalTime.now();
        //创建当前日期
        LocalDate now = LocalDate.now();
        System.out.println(of);
        System.out.println(now);

        System.out.println("获取年份"+now.getYear());
        System.out.println("获取月份"+now.getMonth().getValue());
        System.out.println("获取星期"+now.getDayOfWeek().getValue());

        //创建一个指定日期时间的类
        LocalDateTime dateTime = LocalDateTime.of(2022, 10, 11, 17, 18, 16);
        //创建当前的日期时间对象
        LocalDateTime nows = LocalDateTime.now();

        System.out.println("指定的日期时间:"+dateTime.toString());
        System.out.println("当前的日期时间:"+nows);

    }
}
